<%@ Page Language="C#"%>

<Script runat=server>
  public void Session_Add(Object sender, EventArgs e) {
    Session["cart"] = text1.Value; 
    span1.InnerHtml = "Session data updated! <P>Your session contains: <font color=red>" + Session["cart"] + "</font>";
  }

  public void CheckSession(Object sender, EventArgs e) {
	  if (Session["cart"] == null)
	     span1.InnerHtml = "NOTHING, SESSION DATA LOST!";
	  else
	     span1.InnerHtml = "Your session contains: <font color=red>" + Session["cart"].ToString() + "</font>";
  }
</Script>

<form runat=server>
<input id=text1 type=text runat=server>
<input type=submit runat=server OnServerClick="Session_Add" Value="Add to Session State">
<input type=submit runat=server OnServerClick="CheckSession" Value="View Session State">
</form>
<hr size=1>
<font size=6><span id=span1 runat=server/></font>
<%
Response.Write(Session.Timeout.ToString());
%>